﻿namespace demo12_convert转换
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello, World!");
            //Convert.To你要转换的类型(要转换的值);
            //int
            string s = "13";
            int i = Convert.ToInt32(s);
            Console.WriteLine(i);


            //double
            string s2 = "3.5";
            double d = Convert.ToDouble(s2);
            Console.WriteLine(d);


            //从键盘输入一个三位数的整数，分别输出它的百位、个位和十位数
            Console.WriteLine("请输入一个三位数:");
            int a = Convert.ToInt32(Console.ReadLine());
            int b = a / 100;
            Console.WriteLine(b);
            int c = a % 100 / 10;
            Console.WriteLine(c);
            int g = a % 10;
            Console.WriteLine(g);


            //判断闰年
            //能被4整除 不能被100整除
            //能被400整除
            Console.WriteLine("请输入一个年份:");
            int year = Convert.ToInt32(Console.ReadLine());
            bool dd = year % 400 == 0 || year % 4 == 0 && year % 100 != 0 ? true : false;
            Console.WriteLine(dd);


            //size
            int i3 = sizeof(int);
            Console.WriteLine(i3);



        }
    }
}
